package FamilyAccount;

import java.util.Scanner;

public class util {

    public static int account = 10000;
    public static String details = "";
    static Scanner scan = new Scanner(System.in);
    public static void menu() {
        System.out.println("**************家庭收支记账本**************");
        System.out.println("               1.收支明细");
        System.out.println("               2.登记收入");
        System.out.println("               3.登记支出");
        System.out.println("               4.退   出");
        System.out.print("                 请输入1-4:");
    }

    public static void showDetails() {
        System.out.println("--------------明细查询--------------");
        System.out.println("收支\t金额大小\t账户余额\t说明");
        System.out.println(details);
    }

    public static void expense(boolean flag) {
        System.out.print("请输入金额大小:");
        int num = scan.nextInt();
        System.out.print("请输入金额来源:");
        String temp_details = scan.next();
        if (flag) {
            account += num;
            details += String.format("收入\t%6d\t%d\t%s\n", num, account, temp_details);
        } else {
            account -= num;
            details += String.format("支出\t%6d\t%d\t%s\n", num, account, temp_details);
        }
    }

    public static char read() {
        return scan.next().charAt(0);
    }

    public static char confirm() {
        return  scan.next().charAt(0);
    }
}